import java.io.IOException;
import java.time.LocalDate;
import java.util.Arrays;
import java.util.Date;
import java.util.HashSet;
import java.util.WeakHashMap;
import java.util.concurrent.locks.Condition;
import java.util.concurrent.locks.LockSupport;
import java.util.concurrent.locks.ReentrantLock;

/**
 * @program: javase
 * @description:
 * @author: luolidong
 * @create: 2021-06-24 15:24
 * @version: 1.0
 */
public class A {
    public void  m1() throws Exception {
        try {
            int i=10/0;
//            return i;
        } catch (ArithmeticException e) {
            throw new Exception("throw");
//            System.out.println(e);
        }finally {
            //finally中return会忽略正常返回和catch抛出的异常,如果在finally中声明异常也会覆盖catch抛出的异常
            throw new Exception("finally_throw");
//            return 1;
//            return;
        }
    }
    public void  m2() throws RuntimeException{
            int i=-1;
            if(i<0){
                throw new MyException("i<0");
            }
        System.out.println("i="+i);


    }

    public static void main(String[] args){
        try {
            new A().m1();
//            System.out.println(i);
        } catch (Exception e) {
            e.printStackTrace();
        }

//        try {
//            new A().m2();
//        } catch (Exception e) {
//            e.printStackTrace();
//        }
//        System.out.println("...");

    }
}
